home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1997 April / macformat-049.iso / mac / Shareware Plus / Developers / dropg++ / usr / include / stand.att / saio.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-02-20  |  4.5 KB  |  132 lines  |  [TEXT/R*ch]

  1. /*-
  2.  * Copyright (c) 1982, 1988, 1991, 1993
  3.  *    The Regents of the University of California.  All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms, with or without
  6.  * modification, are permitted provided that the following conditions
  7.  * are met:
  8.  * 1. Redistributions of source code must retain the above copyright
  9.  *    notice, this list of conditions and the following disclaimer.
  10.  * 2. Redistributions in binary form must reproduce the above copyright
  11.  *    notice, this list of conditions and the following disclaimer in the
  12.  *    documentation and/or other materials provided with the distribution.
  13.  * 3. All advertising materials mentioning features or use of this software
  14.  *    must display the following acknowledgement:
  15.  *    This product includes software developed by the University of
  16.  *    California, Berkeley and its contributors.
  17.  * 4. Neither the name of the University nor the names of its contributors
  18.  *    may be used to endorse or promote products derived from this software
  19.  *    without specific prior written permission.
  20.  *
  21.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  22.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  23.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  24.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  25.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  26.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  27.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  28.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  29.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  30.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  31.  * SUCH DAMAGE.
  32.  *
  33.  *    @(#)saio.h    8.1 (Berkeley) 6/11/93
  34.  */
  35.  
  36. #include <sys/time.h>
  37.  
  38. #include <ufs/ffs/fs.h>
  39. #include <ufs/ufs/dinode.h>
  40.  
  41. #include <stand.att/saioctl.h>
  42. #include <stand.att/saerrno.h>
  43.  
  44. #define    UNIX    "/vmunix"
  45.  
  46. #ifndef NULL
  47. #define    NULL    0
  48. #endif
  49.  
  50. /* I/O block */
  51. struct iob {
  52.     int    i_flgs;        /* flags (see F_*) */
  53.     int    i_adapt;    /* adapter or bus */
  54.     int    i_ctlr;        /* controller */
  55.     int    i_unit;        /* pseudo device unit */
  56.     int    i_part;        /* disk partition */
  57.     daddr_t    i_boff;        /* block offset on device */
  58.     daddr_t    i_cyloff;    /* cylinder offset on device */
  59.     off_t    i_offset;    /* seek offset in file */
  60.     dev_t    i_dev;        /* associated device */
  61.     daddr_t    i_bn;        /* 1st block # of next read */
  62.     char    *i_ma;        /* memory address of I/O buffer */
  63.     int    i_cc;        /* character count of transfer */
  64.     int    i_error;    /* error # return */
  65.     int    i_errcnt;    /* error count for driver retries */
  66.     int    i_errblk;    /* block # in error for error reporting */
  67.     char    i_buf[MAXBSIZE];/* I/O buffer */
  68.     struct    dinode i_ino;    /* dinode, if file */
  69.     union {            /* file system super block info */
  70.         struct fs ui_fs;
  71.         char dummy[SBSIZE];
  72.     } i_un;
  73. #define    i_fs    i_un.ui_fs
  74. #define    i_bus    i_adapt
  75. };
  76.  
  77. #define    SOPEN_MAX    4
  78. extern struct iob iob[SOPEN_MAX];
  79.  
  80. /* Codes for sector header word 1 */
  81. #define    HDR1_FMT22    0x1000    /* standard 16 bit format */
  82. #define    HDR1_OKSCT    0xc000    /* sector ok */
  83. #define    HDR1_SSF    0x2000    /* skip sector flag */
  84.  
  85. /* I/O flag values */
  86. #define    F_READ        0x0001    /* file opened for reading */
  87. #define    F_WRITE        0x0002    /* file opened for writing */
  88. #define    F_ALLOC        0x0004    /* buffer allocated */
  89. #define    F_FILE        0x0008    /* file instead of device */
  90. #define    F_NBSF        0x0010    /* no bad sector forwarding */
  91. #define    F_ECCLM        0x0020    /* limit # of bits in ecc correction */
  92. #define    F_SSI        0x0040    /* set skip sector inhibit */
  93. #define    F_SEVRE        0x0080    /* Severe burnin (no retries, no ECC) */
  94.  
  95. /* I/O types */
  96. #define    F_RDDATA    0x0100    /* read data */
  97. #define    F_WRDATA    0x0200    /* write data */
  98. #define    F_HDR        0x0400    /* include header on next i/o */
  99. #define    F_CHECK        0x0800    /* perform check of data read/write */
  100. #define    F_HCHECK    0x1000    /* perform check of header and data */
  101.  
  102. #define    F_TYPEMASK    0xff00    /* I/O type mask */
  103.  
  104. /* Lseek values */
  105. #define    L_SET        0    /* absolute offset */
  106.  
  107. /* Device switch */
  108. struct devsw {
  109.     char    *dv_name;
  110.     int    (*dv_strategy)();
  111.     int    (*dv_open)();
  112.     int    (*dv_close)();
  113.     int    (*dv_ioctl)();
  114. };
  115.  
  116. extern struct devsw devsw[];    /* device array */
  117. extern int ndevs;        /* number of elements in devsw[] */
  118.  
  119. #ifdef COMPAT_42
  120. /*
  121.  * Old drive description table.
  122.  * still used by some drivers for now.
  123.  */
  124. struct st {
  125.     short    nsect;        /* # sectors/track */
  126.     short    ntrak;        /* # tracks/surfaces/heads */
  127.     short    nspc;        /* # sectors/cylinder */
  128.     short    ncyl;        /* # cylinders */
  129.     short    *off;        /* partition offset table (cylinders) */
  130. };
  131. #endif
  132.